package com.woniuxy.homeWork.dao;

import com.woniuxy.homeWork.commons.Transactional;
import com.woniuxy.homeWork.model.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * ClassName:UserMapper
 * Package:com.woniuxy.homeWork.dao
 *
 * @date:2021/11/2 5:42 下午
 * @author: Tiangle
 */
public interface UserMapper {
    @Insert("insert into t_user value(#{id},#{name},#{password});")
    int addUser(User user);
    @Delete("delete from t_user where id=#{id};")
    int deleteUser(Integer id);
    @Update("update t_user set name=#{name},password=#{password} where id=#{id};")
    int updateUser(User user);

    @Select("select * from t_user where id = #{id};")
    User selectUserById(Integer id);
    @Select("select * from t_user")
    List<User> selectUsers();
}
